<?php
namespace UserApi\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
use Zend\View\Model\JsonModel;
class LoginUserApiController extends AbstractRestfulController
{
    public function getList()
    {
		
    }
    public function get($email)
    {
		header('Access-Control-Allow-Origin: *');		
		$userTable=$this->getServiceLocator()->get('Models\Model\UsersFactory');		
		$checkUser = $userTable->checkUniqueRecord($email)->toarray();		
		if(count($checkUser)!=0){
			return new JsonModel(array(
				'data' => 'Email already exists',
				'value' => 1,
			));			
		}else{
			return new JsonModel(array(
				'value' => 0,
				'data'  => 'valid email',
			));			
		}
    }
    public function create($data)
    {
		header('Access-Control-Allow-Origin: *');	
		$userTable=$this->getServiceLocator()->get('Models\Model\UsersFactory');
		$checkUserloginemail = $userTable->checkloginEmail($data)->toArray();
			if(count($checkUserloginemail)!=0){
				return new JsonModel(array(
					'status'		=>	'success',
					'value'			=>	1,
				));	
			}else{
				return new JsonModel(array(
					'status'	=>	'fail',
					'value'		=>   0,
				));			
			}
	}
    public function update($id, $data)
    {
        
    }
    public function delete($id)
    {
       
    }
}